#!/usr/bin/env python3
"""
脚本名称：ch44_exe.py
功能描述：演示类的继承，方法的重写
作者：Gavin
创建日期：2022-05-06
版本：1.0
依赖库：无
使用方法： python ch44_exe.py
"""


class Parent(object):
    def override(self):
        print("PARENT override()")

    def implicit(self):
        print("PARENT implicit()")

    def altered(self):
        print("PARENT altered()")


class Child(Parent):
    def override(self):
        print("CHILD override()")

    def altered(self):
        print("CHILD, BEFORE PARENT altered()")
        super(Child, self).altered()
        print("CHILD, AFTER PARENT altered()")


dad = Parent()
son = Child()
dad.implicit()  # PARENT implicit()
son.implicit()  # PARENT implicit()
dad.override()  # PARENT override()
son.override()  # CHILD override()
dad.altered()  # PARENT altered()
son.altered()
# CHILD, BEFORE PARENT altered()
# PARENT altered()
# CHILD, AFTER PARENT altered()
